CombineToPDF(IEnumerable<String>,Stream,PdfConformance) Method
In This Topic
This method combines all the specified input files to a single PDF document and saves the resulting file to an instantiated output stream object according to what you have specified.
The PDF version or the PDF conformance level of the resulting PDF document is set according to the given Conformance parameter.
Syntax
'Declaration
Public Overloads Function CombineToPDF( _
ByVal As IEnumerable(Of String), _
ByVal As Stream, _
Optional ByVal As PdfConformance _
) As GdPictureStatus
public GdPictureStatus CombineToPDF(
IEnumerable<string> ,
Stream ,
PdfConformance
)
public function CombineToPDF(
: IEnumerable;
: Stream;
: PdfConformance
): GdPictureStatus;
public function CombineToPDF(
: IEnumerable,
: Stream,
: PdfConformance
) : GdPictureStatus;
public: GdPictureStatus CombineToPDF(
IEnumerable<string*>* ,
Stream* ,
PdfConformance
)
public:
GdPictureStatus CombineToPDF(
IEnumerable<String^>^ ,
Stream^ ,
PdfConformance
)
Parameters
- InputFiles
- An array of strings defining the file paths of all the documents you want to combine.
- OutputStream
- An output stream object. This stream object must be initialized before it can be sent into this method and it should stay open for subsequent use.
This stream should be open for writing and should be closed/disposed by the user as well.
- Conformance
- A member of the PdfConformance enumeration. Specifies the required PDF version or conformance to the PDF or PDF/A standard of the resulting PDF document.
Return Value
A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.
We strongly recommend always checking this status first.
Example
Combining multiple files of different formats to a single PDF document.
Dim inputFiles As IEnumerable(Of String) = New List(Of String)(New String() {"d:\image.jpg", "d:\document.pdf", "d:\image.tif", "d:\todo_list.xlsx"})
Using dstStream As Stream = File.Create("d:\merged.pdf")
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
gdpictureDocumentConverter.CombineToPDF(inputFiles, dstStream, PdfConformance.PDF1_5)
End Using
End Using
IEnumerable<string> inputFiles = new List<string>(new string[] { "d:\\image.jpg", "d:\\document.pdf", "d:\\image.tif", "d:\\todo_list.xlsx" });
using (Stream dstStream = File.Create("d:\\merged.pdf"))
{
using (GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter())
{
gdpictureDocumentConverter.CombineToPDF(inputFiles, dstStream, PdfConformance.PDF1_5);
}
}
Example
Combining multiple files of different formats to a single PDF document.
Dim inputFiles As IEnumerable(Of String) = New List(Of String)(New String() {"d:\image.jpg", "d:\document.pdf", "d:\image.tif", "d:\todo_list.xlsx"})
Using dstStream As Stream = File.Create("d:\merged.pdf")
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
gdpictureDocumentConverter.CombineToPDF(inputFiles, dstStream, PdfConformance.PDF1_5)
End Using
End Using
IEnumerable inputFiles = new List(new string[] { "d:\\image.jpg", "d:\\document.pdf", "d:\\image.tif", "d:\\todo_list.xlsx" });
using (Stream dstStream = File.Create("d:\\merged.pdf"))
{
using (GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter())
{
gdpictureDocumentConverter.CombineToPDF(inputFiles, dstStream, PdfConformance.PDF1_5);
}
}
See Also